
<?php
/**
 * 
 * 
 * 参见user_control.php,该文件参考自其中
 * 
 * 功能描述：
 * 	  实现推荐客户
 *  


 * 
 * 
 */


if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Menu_Control extends CI_Controller {
	
	
	

	// 菜单项
	/**
	 * eg:http://192.168.33.10/CI/index.php/menu_control/item
	 * 
	 * eg:http://192.168.33.10/CI/index.php/test_control/test
	 */
	public function item(){
		$this->load->helper('url');
		$this->config->load('_myconfig.php');
		$debug = $this->config->item('mydebug');
		$showdebug = $this->config->item('showdebug');
		$header_data['debug']=$debug;
		$header_data['showdebug']=$showdebug;
		
		$openId = isset($_POST['openId'])?$_POST['openId']:'';
		$state = isset($_POST['state'])?$_POST['state']:'';
		$creator = isset($_POST['creator'])?$_POST['creator']:0;
		$item = isset($_POST['item'])?$_POST['item']:'';
		
		$header_data['openId']=$openId;
		$header_data['state']=$state;
		$header_data['item']=$item;
		$header_data['creator']=$creator;
		
		if($state<1 && $item!=1){
			$item==999;
		}
		
		if($item==1){	//home
			$this->load->model('user_model');
			$user = $this->user_model->getUserByOpenId($openId);	//由openId查询user
			
			$data['openId']=$openId;	// 便于entrance.php缓存使用，方便在导航跳转时候识别客户
			$data['state']=$state;
			$data['creator']=isset($user['id'])?$user['id']:0;
			$data['name']=isset($user['name'])?$user['name']:'SomeBody';
			$data['flag']=isset($flag)?$flag:-1;	
			
			$header_data['title']='回到首页';
			$this->load->view('jjr/block/header',$header_data);
			$this->load->view('jjr/index',$data);
			$this->load->view('jjr/block/footer');
		}
		
		if($item==2){	//add client
			$header_data['title']='推荐客户';
			$this->load->view('jjr/block/header',$header_data);
			$this->load->view('jjr/client1');
			$this->load->view('jjr/block/footer');
		}
		if($item==31){	//add client
			$header_data['title']='个人中心|我的信息';
			$this->load->view('jjr/block/header',$header_data);
			$this->load->view('jjr/block/footer');
		}
		if($item==32){	//add client
			$page=1;
			$_page_size=10;
			$this->load->model('client_model');
			$data = $this->client_model->query_page($creator,($page-1)*$_page_size,$_page_size);
			
			
			$header_data['title']='个人中心|我的客户';
			$this->load->view('jjr/block/header',$header_data);
			$this->load->view('jjr/client_show',$data);
			$this->load->view('jjr/block/footer');
		}
		if($item==4){	//add client
			$header_data['title']='扩展功能';
			$this->load->view('jjr/block/header',$header_data);
			$this->load->view('jjr/block/footer');
		}
		
		if($item==999){	//add client
			$header_data['title']='经纪人';
			$this->load->view('jjr/block/header',$header_data);
			
			if($state==0)
				$data['msg']="请等待审核通过";
			if($state==-1)
				$data['msg']="请点左下方“回到首页”然后注册";
			$this->load->view('jjr/msg',$data);
			$this->load->view('jjr/block/footer');
		}
		
	}
	
	
	

	

	
	
	
	
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */